<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
    <style>
        .active{
            color: red;
        }
    </style>
</head>
<body>
<div id="app">
    <ul>
        <li v-for="(item,index) in list" :class="{active:i===index}" :key = "item" @click="liclick(index)">{{item}} </li>
    </ul>
</div>
<script>
    let app = new Vue({
        el:'#app',
        data:{
            i:0,
            list:['111','222','333','444']
        },
        methods:{
            liclick(index) {
                this.i = index
            }
        }
    })
</script>
</body>
</html>
